package com.kgc.springboot.config;

import com.kgc.springboot.service.OrderService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by MJ on 2020/10/19 11:04
 * 订单配置类
 *
 * @Configuration:指定当前类是一个配置类，用来代替spring的xml配置文件
 */
@Configuration
public class OrderConfig {
    /*
    @Bean：将方法返回值添加到容器中，容器中默认的组件的id是方法名

    * */
    @Bean
    public OrderService orderService(){
        System.out.println("添加组件到ioc容器中");
        return new OrderService();
    }
}
